//
// Created by luolijun on 2021/11/2.
//

#ifndef UI_H
#define UI_H

#include <cstdint>

namespace falcon {

struct POINT {
    double x;
    double y;
    POINT(double x = 0, double y = 0)
        : x(x)
        , y(y) {
    }
};

struct LINE {
    POINT start;
    POINT end;

    explicit LINE(double psx = 0, double psy = 0, double pex = 0, double pey = 0)
        : start(psx, psy)
        , end(pex, pey) {
    }

    explicit LINE(POINT s, POINT e) {
        start = s;
        end = e;
    }
};

struct RECT {
    double aleft;
    double atop;
    double awidth;
    double aheight;
    RECT(double l = 0, double t = 0, double w = 0, double h = 0)
        : aleft(l)
        , atop(t)
        , awidth(w)
        , aheight(h) {
    }
};

struct SIZE {
    double width;
    double height;

    SIZE(double w = 0, double h = 0)
        : width(w)
        , height(h) {
    }
};

enum AlignStyle {
    ALIGN_LEFT = 0x0001,
    ALIGN_RIGHT = 0x0002,
    ALIGN_HCENTER = 0x0004,

    ALIGN_TOP = 0x0020,
    ALIGN_BOTTOM = 0x0040,
    ALIGN_VCENTER = 0x0080,

    AlignCenter = ALIGN_HCENTER | ALIGN_VCENTER,
};

//! 绘图器
struct Painter {
    virtual void drawText(const RECT& rect, uint32_t style, const char* text) = 0;
    virtual void drawRect(const RECT& rect) = 0;
    virtual void drawLine(const LINE& line) = 0;
};

} // namespace falcon
#endif // UI_H
